<template>
	<view class="detail">
		<view class="content">
			<view class="title">
				【{{pageData.title}} 】
			</view>
			<view class="time">
				发布时间：  {{pageData.updated_at}}
			</view>
			<view class="text">
				<rich-text type="text" :nodes="pageData.content"></rich-text>
			</view>
			
		</view>
		
	</view>
</template>

<script>
	var graceRichText = require("../../static/richText.js");
	import {
		notice
	} from "@/api/api.js"
	export default {
		data(){
			return{
				pageId:null,
				pageData:{}
			}
		},
		onLoad(options) {
			if (!uni.getStorageSync("token")) {
				uni.reLaunch({
					url: "../login/index"
				})
				return
			}
			this.pageId = options.id
			this.handleGetnoticeDetail()
		},
		methods:{
			async handleGetnoticeDetail(){
				let res = await notice({
					id:this.pageId
				})
				console.log("公告详情",res)
				this.pageData = res.data
				this.pageData.content =  graceRichText.format(this.pageData.content)
			},
		}
	}
</script>

<style scoped lang="scss">
	.detail{
		width: 100%;
		padding: 30rpx;
		box-sizing: border-box;
		.content{
			width: 100%;
			background-color: #ffffff;
			padding: 28rpx 24rpx;
			box-sizing: border-box;
			.title{
				font-size: 36rpx;
				font-family: PingFang SC-Bold, PingFang SC;
				font-weight: 400;
				color: #333333;
				line-height: 50rpx;
				width: 100%;
				text-align: center;
			}
			.time{
				font-size: 22rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 400;
				color: #333333;
				line-height: 30rpx;
				margin-top: 30rpx;
			}
			.text{
				font-size: 28rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 400;
				color: #333333;
				line-height: 40rpx;
				margin-top: 20rpx;
			}
		}
	}
</style>